package com.example.extenddemo.extendsDemo;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.concurrent.CompletableFuture;

@Component
@Slf4j
public class AsyncDemo {

    @Async
    public void testAsync(){
        log.info("testAsync");
    }

    @Async
    @SneakyThrows
    public CompletableFuture<String> testFutter(){
        log.info("testFutter");
        Thread.sleep(1000);
        return CompletableFuture.completedFuture("testFutter");
    }
}
